<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@page isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script type="text/javascript" src="js/jquery.js"></script>
    <link rel="stylesheet" href="css/bootstrap.min.css" type="text/css"/>
    <link href="css/reg.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" href="css/base.css" type="text/css"/>
    <link rel="stylesheet" href="css/headbott.css" type="text/css"/>
    <link rel="stylesheet" href="css/index.css" type="text/css"/>
    <link rel="stylesheet" href="css/ly-list.css" type="text/css"/>
    <link rel="stylesheet" href="css/reg.css" type="text/css"/>
    <link rel="stylesheet" href="css/back.css" type="text/css"/>
    <title>Title</title>
</head>
<body>
<div id="header">
    <div class="heade-con">
        <div class="logo"><a href=""><img src="images/LOGO.png"/></a></div>
        <div class="nav posa">
            <ul>
                <li><a href="index.jsp">首页</a></li>
                <li><a href="gyzc-list.jsp">公益众筹</a></li>
                <li><a href="cop.jsp">常见问题</a></li>
                <li><a href="ly-list.jsp">众筹资讯</a></li>
                <li><a class="vcolor" href="/gotoProjectInfo" style="">发布项目</a></li>
            </ul>
        </div>
        <div class="search">
            <form action="">
                <input type="text" class="search-txt" value="" placeholder="找项目">
                <input type="submit" class="search-but" value="">
            </form>
        </div>
        <c:if test="${user==null}">
            <div class="index-login">
                <a href="/login.jsp">登录</a>
                <span style="color: white;">|</span>
                <a href="/reg.jsp">注册</a>
            </div>
        </c:if>
        <c:if test="${sessionScope.user.uname!=null}">
            <div style="margin-left: 200px" class="index-login">
                <span  style="color: white"><a href="user.jsp"> 欢迎您，${sessionScope.user.uname}</a> |</span>
                <br>

            </div>

        </c:if>
    </div>
</div>
<!--中间-->
<div class="product">
    <!--头上表格-->
    <div class="product-table">
        <div class="product-left">
            <table class="table table-bordered">
                <tr class="text-center">
                    <%--                    <td class="title-td"><a href="new_product.jsp">基本信息</a></td>--%>
                    <td class="title-td"><a href="/gotoNewInfo">项目信息</a></td>
                    <td class="title-td"><a href="/gotoNewDetail">详细描述</a></td>
                    <td class="active title-td"><a>回报设置</a></td>
                </tr>
            </table>
        </div>
        <div class="product-right">
            <table class="table table-bordered">
                <tr class="text-center">
                    <td class="title-td">预览</td>
                </tr>

            </table>

        </div>
    </div>




    <!--下部form表单-->
    <div class="product-form">



        <!--上标题-->
        <div class="product-title">
            <div class="my-h4">
                <h4>设置你的回报信息</h4>
            </div>
            <div class="btn-save">
                <button class="btn btn-default" id="publish">提交项目</button>
            </div>
        </div>

        <script>
            //点击提交项目  进行项目的提交
            $("#publish").click(function () {

                $.ajax({
                    url:"/publishProject",
                    type:"GET",
                    success:function (result) {
                        if(result=="success"){
                            alert("项目提交成功");
                            window.location.href="/index.jsp";
                        }else {
                            alert("项目提交失败了，请检查后重新提交申请");
                        }

                    }

                })
            })
        </script>


        <%

            int i=1;
            request.setAttribute("i",i);
            //System.out.println((session.getAttribute("backList")).getClass());
        %>

        <c:forEach var="item" items="${sessionScope.backList}">
            <div class="clear"></div>
            <hr>
            <!--描述项目-->
            <div class="product-title">
                <div class="my-h4">
                    <h4><b>回报<%=i++%></b></h4>
                </div>
            </div>
            <div class="clear"></div>
            <hr>
            <!--编辑信息表单-->
            <form action="/deleteBack">
                <div class="back" style="display: none"><b>回报编号：</b><input class="input-mon" name="bno" placeholder="输入需要用户支持的金额" value="${item.bno}" readonly></div>

                <div class="my-form">
                    <div class="back">
                        <b>回报类型</b>
                        <label class="radio-inline">
                            <input type="radio" name="btype"  value="1" <c:if test="${item.btype==1}">checked disabled</c:if> <c:if test="${item.btype==2}">disabled</c:if> > <b>实物回报(回报需邮寄)</b>
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name="btype"  value="2" <c:if test="${item.btype==1}">disabled</c:if> <c:if test="${item.btype==2}">checked disabled</c:if> > <b>虚拟回报(回报无需邮寄)</b>
                        </label>

                            <%--                        <script>
                                                        $(function () {
                                                            var btype=${item.btype};
                                                            if(btype==1){
                                                                $("#optionsRadios3").attr("checked","true");
                                                                $("#optionsRadios4").attr("disabled","true");
                                                            }else {
                                                                $("#optionsRadios4").attr("checked","true");
                                                                $("#optionsRadios3").attr("disabled","true");
                                                            }

                                                        })
                                                    </script>--%>
                    </div>
                    <div class="back"><b>支持金额：</b><input class="input-mon" name="bmoney" placeholder="输入需要用户支持的金额" value="${item.bmoney}" readonly>元</div>
                    <div class="back"><b>具体规则：</b>每 <input class="input-per" name="brule" placeholder="此项必填" value="${item.brule}" readonly>支持者抽出1名中奖者</div>
                    <div class="back"><b>回报内容：</b><div><textarea rows="2" name="bcontent" placeholder="一句话介绍一下你的项目吧" readonly>${item.bcontent}</textarea></div></div>
                    <div class="back"><b>人数上限：</b><input class="input-num" name="bnumber" placeholder="0" value="${item.bnumber}" readonly>个<small>"0"为不需要名额</small></div>
                    <div class="back"><b>回报时间：</b><input class="input-num" name="btime" placeholder="0" value="${item.btime}" readonly>天<small>"0"为开奖后立即发送</small></div>
                    <div class="clear"></div>
                    <hr>
                    <div class="text-center"><button type="submit" class="btn btn-primary">删除</button><button class="btn" style="display: none">保存</button></div><br>
                </div>
            </form>
        </c:forEach>

        <%--一个表单模板--%>
        <div style="display: none" class="old">
            <div class="clear"></div>
            <hr>
            <!--描述项目-->
            <div class="product-title">
                <div class="my-h4">
                    <h4><b>新的回报</b></h4>
                </div>
            </div>
            <div class="clear"></div>
            <hr>
            <!--编辑信息表单-->
            <form action="/addBack">
                <div class="my-form">
                    <div class="back">
                        <b>回报类型：</b>
                        <label class="radio-inline">
                            <input type="radio" name="btype" id="optionsRadios3" value="1" checked> <b>实物回报(回报需邮寄)</b>
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name="btype" id="optionsRadios4"  value="2"> <b>虚拟回报(回报无需邮寄)</b>
                        </label>
                    </div>
                    <div class="back"><b>支持金额：</b><input class="input-mon" name="bmoney" placeholder="输入需要用户支持的金额">元</div>
                    <div class="back"><b>具体规则：</b>每 <input class="input-per" name="brule" placeholder="此项必填"> 支持者抽出1名中奖者</div>
                    <div class="back"><b>回报内容：</b><div><textarea rows="2" name="bcontent" placeholder="一句话介绍一下你的项目吧"></textarea></div></div>
                    <div class="back"><b>人数上限：</b><input class="input-num" name="bnumber" placeholder="0">个<small>"0"为不需要名额</small></div>
                    <div class="back"><b>回报时间：</b><input class="input-num" name="btime" placeholder="0">天<small>"0"为开奖后立即发送</small></div>
                    <div class="clear"></div>
                    <hr>
                    <div class="text-center"><button class="btn btn-primary">删除</button><button type="submit" class="btn">保存</button></div><br>
                </div>
            </form>
        </div>

        <div class="new1">

        </div>

        <div class="text-center"><a href="#" class="btn_plus">+添加新的回报</a></div>
    </div>

    <script>

        window.onload = $(document).ready(function () {
            var pr="${sessionScope.projectTemp.pno}";
            if(pr!=""){

                var old = document.querySelector('.old')
                var btn = document.querySelector('.btn_plus')
                var new1 = document.querySelector('.new1')
                btn.onclick = function () {
                    var div1 = document.createElement('div')
                    div1.innerHTML = old.innerHTML
                    new1.appendChild(div1.cloneNode(true))

                    //不允许再次点击
                    btn.setAttribute("style","display:none")
                }

            }
        })

    </script>

</div>
<!--下部-->
<div id="bottom">
    <div class="bottom-ggt"><a href=""><img src="images/bottbom_68.jpg" alt=""/></a></div>
    <div class="zc-yqlink">
        <ul>
            <li><a href="">阿里巴巴集团</a></li>
            <li><a href="">淘宝网</a></li>
            <li><a href="">天猫</a></li>
            <li><a href="">聚划算</a></li>
            <li><a href="">全球速卖通</a></li>
            <li><a href="">阿里巴巴国际交易市场</a></li>
            <li><a href="">1688</a></li>
            <li><a href="">阿里妈妈</a></li>
            <li><a href="">阿里旅行</a></li>
            <li><a href="">阿里云计算</a></li>
            <li><a href="">阿里巴巴集团</a></li>
            <li><a href="">淘宝网</a></li>
            <li><a href="">天猫</a></li>
            <li><a href="">聚划算</a></li>
            <li><a href="">全球速卖通</a></li>
            <li><a href="">阿里巴巴国际交易市场</a></li>
            <li><a href="">1688</a></li>
            <li><a href="">阿里妈妈</a></li>
            <li><a href="">阿里云计算</a></li>
        </ul>
    </div>
    <div class="footer-bd">

        <a href=" ">关于淘宝</a>
        <a href=" ">合作伙伴</a>
        <a href=" ">营销中心</a>
        <a href=" ">廉正举报</a>
        <a href=" ">联系客服</a>
        <a href=" ">开放平台</a>
        <a href=" ">诚征英才</a>
        <a href=" ">联系我们</a>
        <a href=" ">网站地图</a>
        <a href=" ">法律声明</a>　　　
        <em>© 2003-2015 Taobao.com 版权所有</em><br>

        <br>
        <span>网络文化经营许可证：<a href=" ">浙网文[2013]0268-027号</a></span>
        <b>|</b>
        <span data-spm-protocol="i">增值电信业务经营许可证：<a href="">浙B2-20080224-1</a></span>
        <b>|</b>
        <span>信息网络传播视听节目许可证：1109364号</span>
        <b>|</b>
        <span>举报电话:0571-81683755</span>
    </div>
</div>
</body>
</html>